<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 
<%@ page import="org.jamwiki.utils.*,org.jamwiki.model.*,java.io.*,jxl.*,org.jamwiki.servlets.*,org.jamwiki.*,org.apache.commons.fileupload.FileItem" %>
<%

File uploadedFile = null;
Iterator iterator = ServletUtil.processMultipartRequest(request, Environment.getValue(Environment.PROP_FILE_DIR_FULL_PATH), Environment.getLongValue(Environment.PROP_FILE_MAX_FILE_SIZE));

while (iterator.hasNext()) {
		FileItem item = (FileItem)iterator.next(); 
		try
			{
			Workbook book=
			Workbook.getWorkbook(item.getInputStream());
			//获得第一个工作表对象
			Sheet sheet=book.getSheet(0);
			int count = sheet.getRows();
			System.out.println("count:" + count);
			//得到第一列第一行的单元格
			int i = 1;
			String password = Encryption.encrypt("123456");
			String ip = request.getRemoteHost();
			
			while(i <count){
				
				Cell cell1=sheet.getCell(0,i);
				Cell cell2=sheet.getCell(1,i);
				Cell cell3=sheet.getCell(2,i);
				String result=cell1.getContents();
				String result1=cell2.getContents();
				String result2=cell3.getContents();
				WikiUser user = new WikiUser(result);
				user.setDisplayName(result1);
				user.setCreateIpAddress(ip);
				user.setLastLoginIpAddress(ip);
				user.setPassword(password);
				WikiUserInfo userInfo = new WikiUserInfo();
				userInfo.setUsername(user.getUsername());
				userInfo.setEmail(result2);
				userInfo.setFirstName("");
				userInfo.setLastName("");
				userInfo.setEncodedPassword(password);
				System.out.println(result); 
				i++;
				WikiBase.getDataHandler().writeWikiUser(user,userInfo,null);
			}
			book.close();
			}catch(Exception e)
			{
			System.out.println(e);
			}
		
		}
%>